package com.youmeek.ssm.module.category.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.youmeek.ssm.basic.core.model.BaseValueObject;


/**
 * @classname: TaxCode
 * @description: 税收分类编码
 * @modify liuyong
 * @date 2016年12月1日
 *
 */
@JsonSerialize
public class TaxCode extends BaseValueObject implements Comparable<TaxCode> {

    /**
     * @fields serialVersionUID :
     */
    private static final long serialVersionUID = 1L;

    /** 主键 */
    @JsonIgnore
    private String productTaxCodeId;

    /** 篇 */
    @JsonIgnore
    private String piece;

    /** 类 */
    @JsonIgnore
    private String clazz;

    /** 章 */
    @JsonIgnore
    private String chapter;

    /** 节 */
    @JsonIgnore
    private String section;

    /** 条 */
    @JsonIgnore
    private String strip;

    /** 款 */
    @JsonIgnore
    private String paragraph;

    /** 项 */
    @JsonIgnore
    private String term;

    /** 目 */
    @JsonIgnore
    private String essay;

    /** 子目 */
    @JsonIgnore
    private String subEssay;

    /** 细目 */
    @JsonIgnore
    private String detail;

    /** 合并编码 */
    private String mergeCoding;

    /** 货物和劳务名称 */
    private String goodsName;

    private String code;

    private String mergeFirstLevel;

    private boolean isParent;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMergeFirstLevel() {
        return mergeFirstLevel;
    }

    public void setMergeFirstLevel(String mergeFirstLevel) {
        this.mergeFirstLevel = mergeFirstLevel;
        this.isParent = "Y".equals(mergeFirstLevel);
    }

    public boolean isIsParent() {
        return isParent;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public String getMergeCoding() {
        return mergeCoding;
    }

    public void setMergeCoding(String mergeCoding) {
        this.mergeCoding = mergeCoding;
    }

    public String getProductTaxCodeId() {
        return productTaxCodeId;
    }

    public void setProductTaxCodeId(String productTaxCodeId) {
        this.productTaxCodeId = productTaxCodeId == null ? null : productTaxCodeId.trim();
    }

    public String getPiece() {
        return piece;
    }

    public void setPiece(String piece) {
        this.piece = piece == null ? null : piece.trim();
    }

    public String getClazz() {
        return clazz;
    }

    public void setClazz(String clazz) {
        this.clazz = clazz == null ? null : clazz.trim();
    }

    public String getChapter() {
        return chapter;
    }

    public void setChapter(String chapter) {
        this.chapter = chapter == null ? null : chapter.trim();
    }

    public String getSection() {
        return section;
    }

    public void setSection(String section) {
        this.section = section == null ? null : section.trim();
    }

    public String getStrip() {
        return strip;
    }

    public void setStrip(String strip) {
        this.strip = strip == null ? null : strip.trim();
    }

    public String getParagraph() {
        return paragraph;
    }

    public void setParagraph(String paragraph) {
        this.paragraph = paragraph == null ? null : paragraph.trim();
    }

    public String getTerm() {
        return term;
    }

    public void setTerm(String term) {
        this.term = term == null ? null : term.trim();
    }

    public String getEssay() {
        return essay;
    }

    public void setEssay(String essay) {
        this.essay = essay == null ? null : essay.trim();
    }

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public String getSubEssay() {
        return subEssay;
    }

    public void setSubEssay(String subEssay) {
        this.subEssay = subEssay;
    }

    @Override
    public String toString() {
        return mergeCoding + ":" + goodsName;
    }

    private static final TaxCode TOP_CODE = new TaxCode() {

        {
            setMergeCoding("0");
            setGoodsName("所有编码");
            setMergeFirstLevel("Y");
        }
    };

    public static TaxCode topCode() {
        return TOP_CODE;
    }

    @Override
    public int compareTo(TaxCode o) {
        return mergeCoding.compareTo(o.mergeCoding);
    }
}
